#coding:utf-8
'''配置web html文件访问的视图'''

from flask import Blueprint,current_app

html = Blueprint('html',__name__)

#              re为注册好的万能转换器
@html.route("/<re(r'.*'):html_path>")
def html_view(html_path):
    #先判断是否为空

    print(html_path,'---------------------')

    # 判断空路径
    # if html_path is None:
    #     html_path = 'index.html'
    #todo  注意,''不等于None
    if not html_path:
        html_path = 'index.html'


    # 判断是否是favicon.ico
    if html_path != 'con.ico':
        html_path = 'html/'+ html_path

    print(html_path)
    # return current_app.send_static_file(file_path)
    return current_app.send_static_file(html_path)




